<?php
		include("dbconn.inc");
		include("dbfuc.inc");
		include("session.inc");		
		$user=$_SESSION["user"];
		$curid=$_SESSION["curid"];
		$dbconnection=$_SESSION["dbconnection"];		
	if(session_is_registered("dbconnection") )
	{
	
?>
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
.style11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #999999; }
.style12 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style14 {font-size: 12px}
.style15 {color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; }
.style16 {color: #000000}
.style6 {	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}
.style9 {color: #184584}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<?php
		if(($user!="") && (($curid!="") || ($curid!=0)))
		{
			$sql="";
			$txtval=$_REQUEST["val"];

		//echo $user;

			if(checkString($txtval)) { 
				echo "Invalid New User Name"; 
      		 }
       		 else if(isContainSpecialChars($txtval))
			{        			
				echo "Invalid (Capital letters and Digits only)"; 
       		}
    		 else if((strlen($txtval))<3)
			{
				echo "Invalid (Minium three characters)"; 
    	     }
             else if(strlen($txtval)>11)
				{
					echo "Invalid (Maximum 10 characters)"; 
    	         }
	        	else  
				{
										$sql="select c_username from mlm_master where c_username='$txtval' ";
										$result=mysql_query($sql);
										$rownum=mysql_num_rows($result);
										if($rownum >0)
										{
											$rownum=$rownum-1;
											echo "Already existing User Name"; 
										}
										else
										{
										echo "Available"; 
										}
									}


		

?> 
</body>
</html>
<?php
	}
	}
	else
	{
		$errormsg="Your session is expeired. Please login again.";
		header("location: index.php?error=$errormsg");
	}
?>	
